/**
 * Copyright (c) 2009-2011, chunquedong(YangJiandong)
 * 
 * This file is part of ChunMap project
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE(Version >=3)
 * 
 * History:
 *     2010-05-05  Jed Young  Creation
 */
package chunmap.app;

import java.awt.Graphics;

import javax.swing.JPanel;
/**
 * 轻量级地图控件
 * @author chunquedong
 * 
 */
public class MapPanel extends JPanel {
	private static final long serialVersionUID = -2225507120052664760L;

	private MapCtrl map;
	
	public MapPanel(int width, int height) {
		super();
		this.setSize(width, height);
		map=new MapCtrlImpl(this);
	}

	public MapCtrl getMap() {
		return map;
	}

	@Override
	public synchronized void paintComponent(Graphics g) {
		g.drawImage(map.getBufferImage(), 0, 0, this);
		g.drawString("ChunMap", 2, 15);
	}
}